Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

409
Views
Docker: standard_init_linux.go:211: el proceso de usuario exec causó "no existe tal archivo o directorio"

Estoy tratando de crear una imagen base siguiendo las instrucciones proporcionadas en la página web oficial de Docker ( https://docs.docker.com/samples/library/scratch/ )

 docker --version Docker version 18.09.6, build 481bc77 OS Details: NAME="Ubuntu" VERSION="18.04.2 LTS (Bionic Beaver)"

DockerFile:

 FROM scratch COPY hello / CMD ["/hello"]

Hola C

 #include <stdio.h> int main() { // printf() displays the string inside quotation printf("Hello, World!"); return 0; }

Puedo compilar el programa C y ejecutarlo localmente

Puedo construir la imagen usando el dockerfile pero cuando trato de ejecutar el contenedor, aparece el siguiente error:

 # docker run -i hello standard_init_linux.go:211: exec user process caused "no such file or directory" #

Espero que el contenedor se ejecute correctamente e imprima "Hello World" en la consola. la mayoría de las respuestas proporcionadas solicitan cambiar el EOL, lo que no es aplicable ya que ya estamos en Linux y no intentamos ejecutar el script.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Supongo que obtienes este error porque creaste un binario vinculado dinámico como el siguiente:

 $ gcc -o hello hello.c $ ldd hello linux-vdso.so.1 (0x00007ffe3b1ec000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7fe1fc7000) /lib64/ld-linux-x86-64.so.2 (0x00007f7fe25ba000)

El scratch es realmente básico, que no tiene tantos so para su enlace binario a dinámico. Por lo tanto, debe crear un enlace binario estático, como:

 $ gcc -o hello -static hello.c $ ldd hello not a dynamic executable

Entonces, funcionará como el siguiente:

 $ docker build -t hello . Sending build context to Docker daemon 848.4kB Step 1/3 : FROM scratch ---> Step 2/3 : COPY hello / ---> 9d594b34f774 Step 3/3 : CMD ["/hello"] ---> Using cache ---> 2f1bad3099d3 Successfully built 2f1bad3099d3 Successfully tagged hello:latest $ docker run -i hello Hello, World!

Y, si no usa una imagen .so scratch el sistema, entonces no necesita construir un binario estático.

over 4 years ago · Santiago Trujillo Report

0

Parece que esto sucede cuando los guiones tienen saltos de línea incorrectos. Según la configuración de git, es posible que tenga DOS CRLF en lugar de UNIX LF. Establecer los saltos de línea me ayudó a solucionar el problema.

Cómo cambiar la configuración de final de línea

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!